﻿using System;
using System.Collections.Generic;
using System.Text;
using Pixysoft.Framework.Reflection;
using Pixysoft.Weblications.Sango.Formular;
using Pixysoft.Weblications.Sango.Dao;
using Pixysoft.Weblications.Sango.Constant;

namespace Pixysoft.Weblications.Sango.Command.player
{
    partial class SangoPlayerHandler
    {
        public player_donateinfo player_donateinfo()
        {
            string userCode = SangoManager.Authentication();

            player_donateinfo response = ReflectionManager.CreatePojo<player_donateinfo>();
            response.Succeed = false;

            Entities.Usr_Profile profile = UsrProfileDao.getUsrProfile(userCode);

            long soulvalue = PlayerFormular.getDonateRequiredSoulvalue(profile.Userlevel);

            // fame + party addition

            long famevalue = PlayerFormular.getDonateFamevalue(profile.Userlevel);
            Entities.Usr_Partymember member = PartyDao.tryGetActiveMember(userCode);
            if (member != null)
            {
                famevalue = PartyDao.getMissionAddition(member.Partyprimarycode, PtyMissionTypecodeCollection.DONATE, famevalue);
            }

            response.fame = famevalue;
            response.soul = soulvalue;
            response.Succeed = true;
            return response;
        }
    }

    public interface player_donateinfo : ISangoResponse
    {
        long soul { get;set;}

        long fame { get;set;}
    }
}
